<?php

namespace App\Jobs;

use App\Repos\FFMpeger;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\Redis;

class RecordVideo implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $path;
    protected $rtmp;
    protected $duration;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($path='',$rtmp='',$duration='')
    {
        $this->path = $path;
        $this->rtmp = $rtmp;
        $this->duration = $duration;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $ffmpeg = new FFMpeger();
        $ffmpeg->setTargetPath($this->path)->recordVideo($this->rtmp,$this->duration);
    }
}
